class GoodsMiddelWare {
  async validator(ctx, next) {
    try {
      ctx.verifyParams({
        goods_name: {
          type: "string",
        },
        goods_num: {
          type: "number",
        },
        goods_price: {
          type: "number",
        },
        goods_img: {
          type: "string",
        },
      });
      await next();
    } catch (e) {
      ctx.body = {
        code: 200,
        msg: e.errors,
      };
    }
  }
}

module.exports = new GoodsMiddelWare();
